<?php

class Model_Connections extends Zend_Db_Table_Abstract {

    private static $instance = null;
    protected $db = null;

    private function initDbConnection() {
        $this->db = Zend_Registry::get('db');
        $this->db->query("SET NAMES 'utf8'");
        Zend_Db_Table::setDefaultAdapter($this->db);
    }

    public function __construct() {
        $this->initDbConnection();
    }

    public function getDbConnect() {
        if ($this->db == null) {
            $this->initDbConnection();
        }
        return $this->db;
    }

    public static function getInstance() {
        if (Model_Connections::$instance == null)
            Model_Connections::$instance = new Model_Connections();
        return Model_Connections::$instance;
    }
}

?>
